
<%@page import="java.util.EnumMap"%>
<%@page import="java.util.Date"%>
<%@page import="classes.Register" %>

<%
request.setAttribute("page", "join");
%>

<jsp:include page="header.jsp" flush="true"/>

<% 

  String fname       = request.getParameter("fname") == null ? "" : request.getParameter("fname");
  String lname       = request.getParameter("lname") == null ? "" : request.getParameter("lname");
  String email       = request.getParameter("email") == null ? "" : request.getParameter("email");
  String pwd         = request.getParameter("pwd");
  String pwdconf     = request.getParameter("pwdconf");
  String parentemail = request.getParameter("parentemail");
  String schoolname  = request.getParameter("schoolname");
  String location    = request.getParameter("location");
  String grade       = request.getParameter("grade");
  String dob         = request.getParameter("dob");
  String iam13       = request.getParameter("iam13");
  String cmd         = request.getParameter("cmd");
  boolean registered = false; 
  
  Register reg = new Register();

  if( cmd != null && cmd.equals("register") ) {
    registered = reg.processFormData(fname,
    			lname,
    			email,
    			parentemail,
    			schoolname,
    			location,
    			grade,
    			java.sql.Date.valueOf( "2010-01-31"),
    			iam13,
    			pwd);
    
  if( reg.message.equals("")) {
%>
 
<span style="color:#ffffff">
  <br>Thank You<br>
  Your userid is <%=email %><br>
  <%-- Your SchooledIn ID is <%=schooledinid %>  and can be referened by 
  <a href="#">http://www.schooledIn.com/</a><br>--%>
  A registration confirmation will be sent to <%=email%>
  <br>
</span>
<%
    }
    else
        out.write("ERROR " + reg.message);
}
else {
%>
     

<form METHOD=POST ACTION="Register.jsp">
  <input type="hidden" name="cmd" value="register">
  <div class="register" style="padding-top:20px;">
	<div class="content" style="padding-right:150px">
	  <span class="generalText">
	    First Name: <input type="text" name="fname" size="25" value="<%=fname %>" /><br>
	    Last Name: <input type="text" name="lname" size="25" value="<%=lname%>" /><br>
	    Email: <input type="text" name="email" size="25" value="<%=email%>" /><br>
        Password: <input type="password" size="25" name="pwd" /><br>
	    Password Confirmation: <input type="password" size="25" name="pwdconf" /><br>
	    Parent Email: <input type="text" size="25" name="parentemail" /><br>
	    School Name: <input type="text" size="25" name="schoolname" /><br>
	    Location: <input type="text" size="25" name="location" /><br>
	    Grade: <input type="text" size="25" name="grade" /><br>
	    DOB: <input type="text" size="25" name="age" /><br><br>
	    I Am 13 or Above <input type="checkbox" name="iam13" value="iam13" /><br><br>
	  </span>
      <input type="submit" value="Register" />
    </div>
  </div>
</form>
<%
}
%>

<jsp:include page="footer.jsp" flush="true"/>